Skip to content

Conversation

@nikola-jovanovic-php
Copy link

Summary

This adds full Symfony 8.0 support including:

  • Add ^8.0 to symfony/config requirement
  • PHP 8.5 compatibility fixes
  • Various deprecation fixes for Symfony 7.4/8.0
  • Fix usage of deprecated Request::get() method
  • Fix deprecated usages of symfony/validator

References

dev-craftec and others added 25 commits May 23, 2025 10:50
Fixes "Passing an array of options to configure the \"FOS\\RestBundle\\Validator\\Constraints\\Regex\" constraint is deprecated, use named arguments instead."
…x/test-mime-type

Fix MimeTypeTest for Symfony 7.4
…ted-methods

Don't use deprecated `#[Route]` methods
…x-validator-constructor-fix

FIx usage of Regex validator constructor
…deprecations

Fix deprecations from symfony/validator
Using xml is deprecated in symfony 7.4
Use php instead of xml for service configuration
# Conflicts:
#	Tests/EventListener/MimeTypeListenerTest.php
@gemini-code-assist
Copy link

Summary of Changes

Hello @nikola-jovanovic-php, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly updates the FOSRestBundle to ensure full compatibility and support for Symfony 8.0 and PHP 8.5. It integrates recent upstream changes, resolves numerous deprecation warnings, and adapts the codebase to changes in Symfony's API, particularly concerning request handling, validator constraints, and PHP's reflection API. The primary goal is to modernize the bundle and maintain its functionality with the latest versions of Symfony.

Highlights

  • Symfony 8.0 Support: Added ^8.0 to the version requirements for various Symfony components in composer.json, explicitly declaring support for Symfony 8.0.
  • Upstream Merges: Incorporated 22 commits from the upstream FriendsOfSymfony/FOSRestBundle 3.x branch and merged changes from the W0rma/FOSRestBundle fix-symfony8 branch.
  • Deprecation Fixes: Addressed multiple deprecation warnings for Symfony 7.4/8.0, including updating the usage of Request::get() to Request::attributes->get() and fixing deprecated usages within the symfony/validator component.
  • PHP 8.5 Compatibility: Included specific fixes to ensure the bundle remains compatible with PHP 8.5.
  • Reflection API Adjustments: Updated the usage of ReflectionProperty::setAccessible() and ReflectionMethod::setAccessible() with conditional checks for PHP_VERSION_ID < 80100 to maintain compatibility with PHP 8.1 and newer versions.
  • Constraint Instantiation Refinements: Modified how Regex, Image, and File constraints are instantiated and configured to align with newer Symfony Validator practices, including direct argument passing and property-based option assignment.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/continuous-integration.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for Symfony 8.0 by updating dependencies and fixing various deprecations. The changes are well-implemented and cover compatibility with symfony/validator and PHP 8.1+. I've found a minor issue in one of the test files where the updated assertions for File and Image constraints use an incorrect constructor signature. I've provided suggestions to fix this. Overall, this is a great update.

$this->param->requirements = ['mimeTypes' => 'application/json'];
$this->assertEquals([
new File($requirements),
new File(null, null, null, 'application/json'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The constructor for Symfony\Component\Validator\Constraints\File has changed in newer Symfony versions. The current instantiation new File(null, null, null, 'application/json') is incorrect as it passes the mime type as the 4th argument, which corresponds to mimeTypesMessage. It should be the 3rd argument (mimeTypes).

            new File(null, null, 'application/json'),

$this->assertEquals([
new NotNull(),
new Image($requirements),
new Image(null, null, null, ['image/*']),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to the File constraint, the constructor for Symfony\Component\Validator\Constraints\Image has changed. The current instantiation new Image(null, null, null, ['image/*']) is incorrect. The mime types should be passed as the 3rd argument.

            new Image(null, null, ['image/*']),

$this->assertEquals([new All([
new NotNull(),
new Image($requirements),
new Image(null, null, null, ['image/*']),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The instantiation of the Image constraint inside All is incorrect. The mime types should be the 3rd argument to the constructor, not the 4th.

            new Image(null, null, ['image/*']),

$this->assertEquals([new All([
new NotNull(),
new File($requirements),
new File(null, null, null, 'application/pdf'),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The instantiation of the File constraint inside All is incorrect. The mime type should be the 3rd argument to the constructor, not the 4th.

            new File(null, null, 'application/pdf'),

@deluxetom deluxetom merged commit 348031c into sctr:3.x Jan 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants